package io.test.components;

import io.github.libkodi.basic_gateway.component.AbstractComponents;
import io.github.libkodi.basic_gateway.component.ComponentMethod;
import io.github.libkodi.vertxauth.data.AuthDataCenter;
import io.test.config.Token;
import io.vertx.redis.client.Redis;

public class RedisComponent extends AbstractComponents {
	
	@ComponentMethod
	public AuthDataCenter getRedisClient() {
		Object url = ctx.configValue("redis.url");
		
		if (url != null) {
			return new AuthDataCenter(Redis.createClient(ctx.vertx(), (String) url), "");
		}
		
		return null;
	}
	
	@ComponentMethod
	public Token getToken() {
		return new Token("a token");
	}
}
